package com.itfreer.power.dao.user;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;

import org.springframework.beans.BeanUtils;

import com.itfreer.form.api.JdbcBaseEntity;
import com.itfreer.power.entity.user.VUserRoleEntity;

/**
 * 定义用户详细信息实体
 */
@Entity(name = "v_sso_user_role")
public class JdbcVUserRoleEntity implements JdbcBaseEntity<VUserRoleEntity>, Serializable {

	private static final long serialVersionUID = 3065523710938752296L;

	/**
	 * 帐号 唯一值
	 */
	@Id
	@Column(name = "id", length = 50, nullable = false)
	private String userid;
	
	/**
	 * 用户名
	 */
	@Column(name = "user_name", length = 50, nullable = true)
	private String userName;

	/**
	 * 所属机构
	 */
	@Column(name = "organization_id", length = 50, nullable = true)
	private String organizationId;

	/**
	 * 所属部门
	 */
	@Column(name = "department_id", length = 50, nullable = true)
	private String departmentId;

	/**
	 * 所属岗位
	 */
	@Column(name = "operating_post_id", length = 50, nullable = true)
	private String operatingPostId;

	/**
	 * 帐号
	 */
	@Column(name = "s_accounts", length = 50, nullable = false)
	private String accounts;
	
	/**
	 * 是否有效
	 */
	@Column(name = "is_valid", nullable = false)
	private Boolean valid = true;
	
	/**
	 * 角色集
	 */
	@Column(name = "roles", nullable = false)
	private String roles;

	/**
	 * 帐号 唯一值
	 */
	public String getUserid() {
		return userid;
	}

	/**
	 * 帐号 唯一值
	 */
	public void setUserid(String userid) {
		this.userid = userid;
	}

	/**
	 * 所属机构
	 */
	public String getOrganizationId() {
		return organizationId;
	}

	/**
	 * 所属机构
	 */
	public void setOrganizationId(String organizationId) {
		this.organizationId = organizationId;
	}

	/**
	 * 所属部门
	 */
	public String getDepartmentId() {
		return departmentId;
	}

	/**
	 * 所属部门
	 */
	public void setDepartmentId(String departmentId) {
		this.departmentId = departmentId;
	}

	/**
	 * 所属岗位
	 */
	public String getOperatingPostId() {
		return operatingPostId;
	}

	/**
	 * 所属岗位
	 */
	public void setOperatingPostId(String operatingPostId) {
		this.operatingPostId = operatingPostId;
	}

	/**
	 * 用户名
	 */
	public String getUserName() {
		return userName;
	}

	/**
	 * 用户名
	 */
	public void setUserName(String userName) {
		this.userName = userName;
	}
	
	public String getRoles() {
		return roles;
	}

	public void setRoles(String roles) {
		this.roles = roles;
	}
	
	public String getAccounts() {
		return accounts;
	}

	public void setAccounts(String accounts) {
		this.accounts = accounts;
	}

	public Boolean getValid() {
		return valid;
	}

	public void setValid(Boolean valid) {
		this.valid = valid;
	}
	
	@Override
	public void from(VUserRoleEntity t) {
		BeanUtils.copyProperties(t, this);
	}

	@Override
	public VUserRoleEntity toEntity() {
		VUserRoleEntity toEntity = new VUserRoleEntity();
		BeanUtils.copyProperties(this, toEntity);
		return toEntity;
	}

	@Override
	public void setId(String arg0) {
		this.setUserid(arg0);
	}
}
